import { IRootDispatch } from '@/store';

const {{ camelCase name }}Model = {
  state: {
    info: {},
  },

  reducers: {
    updateInfo(prevState, payload: any) {
      return { ...prevState, ...payload };
    },
  },

  effects: (dispatch: IRootDispatch) => ({
    async fetchData(payload: any) {
      const data = await new Promise((resolve) => {
        console.log('fetchData', payload);
        resolve({ info: { name: 'hello world' } });
      });
      if (data) {
        dispatch.{{ camelCase name }}.updateInfo(data);
      }
    },
  }),
};

export default {{ camelCase name }}Model;
